package org.raymond.iworks.apis.fallbackFactory;

import lombok.extern.slf4j.Slf4j;
import org.raymond.iworks.apis.ITSysUserServiceApi;
import org.raymond.iworks.apis.common.Result;
import org.raymond.iworks.apis.vo.TransFileVO;
import org.raymond.iworks.apis.vo.user.*;
import org.raymond.iworks.commons.utils.ErrorUtil;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class ITSysUserServiceFallbackFactory implements FallbackFactory<ITSysUserServiceApi> {
    @Override
    public ITSysUserServiceApi create(Throwable throwable) {
        final String error = ErrorUtil.getErrorLog(throwable);
        log.error(error);
        return new ITSysUserServiceApi() {
            @Override
            public Result<String> usernameAuthentication(String username, String password) {
                return Result.error(error);
            }

            @Override
            public Result create(UserCreateVO vo) {
                return Result.error(error);
            }

            @Override
            public Result update(UserUpdateVO vo) {
                return Result.error(error);
            }

            @Override
            public Result delete(UserDelVO vo) {
                return Result.error(error);
            }

            @Override
            public Result page(UserPageVO vo) {
                return Result.error(error);
            }

            @Override
            public Result getById(Long id) {
                return Result.error(error);
            }

            @Override
            public Result current() {
                return Result.error(error);
            }

            @Override
            public Result login(UserLoginVO vo) {
                return Result.error(error);
            }

            @Override
            public Result logout() {
                return Result.error(error);
            }

            @Override
            public Result importExcel(TransFileVO transFileVO) {
                return Result.error(error);
            }

            @Override
            public void exportExcel(UserPageVO vo) {}
        };
    }
}
